-
Notifications
You must be signed in to change notification settings - Fork 473
docs(reanalyze): add DCE refactor plan #8043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
I don't see an explicit mention of monorepos or npm/yarn/pnpm workspaces. In this context "dependencies" only refer to other files, but there is still the missing use case when one has shared code like this: where the root "workspaces": [
"common",
"mobile",
"web"
]and the root "dependencies": [
"common",
"mobile",
"web",
]And "dependencies": []Whereas both "dependencies": [
"common"
]And we want DCE to mark stuff as dead that is part of This needs to be an option to configure because when e.g. developing a library with tests, I might have tests dependent on the main package, but not 100 % coverage. The knowledge about package manager monorepos is mostly in Also tagging @nojaf and @DZakh who are users of bun and pnpm monorepos. |
This is a behavior preserving refactor. |
- Introduce BindingContext in DeadValue to track the current binding location during dead-code traversal, so binding context is explicit and locally encapsulated. - Introduce ReportingContext in DeadCommon to track, per file, the end position of the last reported value when deciding whether to suppress nested warnings. - Replace addValueReference_state with addValueReference ~binding, so value-reference bookkeeping is driven by an explicit binding location rather than a threaded analysis state. - Update dead-code value and exception handling to use the new addValueReference API. - Refresh DEADCODE_REFACTOR_PLAN.md to mark these state-localisation steps as completed and to narrow the remaining follow-up to making the binding context fully pure. - Verified with make test-analysis that behaviour and expected outputs remain unchanged.
This PR introduces a planning document for refactoring the reanalyze dead code analysis into a pure, order-independent pipeline.
There are no behavioural changes in this PR: it only adds documentation to coordinate subsequent work on the dead code analysis pipeline.